package com.education.springbootdemo.mapper;


import com.education.springbootdemo.domain.doto.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    Long addCategory(Category category) throws Exception;

    @Select("select  id,category_name as categoryName,category_alias as categoryAlias, create_user as createUser,create_time as createTime,update_time as updateTime from category where id = #{id}")
    Category queryById(Long id);

    @Select("select   id, category_name as categoryName,category_alias as categoryAlias, create_user as createUser,create_time as createTime,update_time as updateTime from category")
    List<Category> queryAllCategory();

    //删除
    @Delete("delete from  category where id = #{id}")
    Long deleteCategory(Long id);
}
